/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.struts.unittests;

import opiam.admin.faare.struts.service.MenusConfig;
import opiam.admin.faare.struts.service.StrutsService;
import opiam.admin.faare.struts.service.beans.JBMenu;
import opiam.admin.faare.struts.service.beans.JBMenus;

import junit.framework.TestCase;


/**
 * @author triyanto
 *
 */
public class MenusConfigTest extends TestCase
{
    /**
     * Constructor for ProfilesDigesterTest.
     * @param arg0 Class name
     */
    public MenusConfigTest(String arg0)
    {
        super(arg0);
    }

    /**
     * DOCUMENT ME!
     *
     * @param args DOCUMENT ME!
     */
    public static void main(String[] args)
    {
        junit.textui.TestRunner.run(MenusConfigTest.class);
    }

    /**
     * DOCUMENT ME!
     */
    public void testReadConfig()
    {
        try
        {
            System.out.println("... starting");

            JBMenus jbMenus = MenusConfig.getInstance().readConfig(this.getClass()
                                                                                 .getResourceAsStream(StrutsService.MENUS_XML_FILE));

            System.out.println(jbMenus);                                                             
            JBMenu jbMenu = jbMenus.findMenuByName("vertical_menu", "prof1");

            System.out.println(jbMenu);
            System.out.println("... finished");
            assertTrue(true);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            assertTrue(false);
        }
    }
}
